<!DOCTYPE html>

<html xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://java.sun.com/jsp/jstl/core">


<h:head>

	<style type="text/css">
.content {
	position: relative;
	width: 100%;
	margin: 0 auto;
}

.ui-layout,.ui-layout-doc,.ui-layout-unit,.ui-layout-wrap,.ui-layout-bd,.ui-layout-hd
	{
	border: none;
}

body {
	margin: 3% 7% 3% 7%;
}

.ui-widget,.ui-widget .ui-widget {
	font-size: 95%;
}

.ui-panelmenu-header,.ui-menuitem-text {
	font-size: 10pt
}

.companyHeaderGrid tr,.companyHeaderGrid td {
	border: none;
}
</style>

</h:head>

<h:body>
	<img class="content" src="resources/images/top.jpg" alt="immagine top"></img>

	<p:layout fullPage="false"
		style="border:none; min-width: 90%; min-height: 600px">

		<!-- TOOLBAR DELLA PAGINA CON I CAMPI DI LOGIN -->
		<p:layoutUnit position="north"
			style="min-height:80px; font-size: 13pt">
			<p:toolbar>
				<p:toolbarGroup align="left">
					<p:outputLabel value="Benvenuto!"
						style="margin: 10px; font-size: 15pt"></p:outputLabel>
				</p:toolbarGroup>
				<p:toolbarGroup align="right">
					<h:form>
						<p:commandButton value="Accedi come Impiegato"
							action="login_impiegato">

							<!--
							 -->

						</p:commandButton>
						<p:commandButton value="Accedi come Cliente"
							action="login_cliente">
							<p:ajax async="true"
								listener="#{pacchettoBean.obtainListaPacchettiCliente}" />
						</p:commandButton>
					</h:form>
				</p:toolbarGroup>
			</p:toolbar>
		</p:layoutUnit>



		<!-- START - ZONA DX DELLA PAGINA -->
		<p:layoutUnit id="center_layout" position="center"
			style="border:none;">


			<!-- PANNELLO DI RICERCA DI UN PACCHETTO -->
			<h:form id="id_pack">
				<p:panel id="search_packet_by_id_panel" header="Cerca pacchetto">
					<h:inputText id="packet_search_id" required="true"
						style="width: 100%; font-size: 14pt" binding="#{id}"
						requiredMessage="Identificativo del pacchetto necessario!" />
					<p:messages for="packet_search_id" />
					<h:form>
						<p:commandButton icon="ui-icon-search" iconPos="right"
							style="width: 100%;font-size: 12pt" value="Cerca pacchetto"
							action="#{pacchettoBean.cercaPacchettoViaID(id.value)}"
							update=":id_pack" />
					</h:form>

				</p:panel>
			</h:form>




			<p:separator style="margin: 30px; height: 13px" />




			<!-- PANNELLO DI REGISTRAZIONE -->

			<h:form id="register_form">

				<p:growl id="growl" for="growl" showDetail="true" sticky="true" />


				<p:panelGrid id="register_panel" columns="3"
					style="font-size: 12pt;width: 75%;margin: 0 auto;"
					styleClass="companyHeaderGrid">

					<f:facet name="header">
						<h:outputLabel> Dati di Registrazione </h:outputLabel>
					</f:facet>


					<h:outputLabel for="new_nome" value="Nome: *" />
					<p:inputText id="new_nome" required="true" label="Nome"
						value="#{utenteBean.user.nome}" />
					<p:message for="new_nome" display="icon" />

					<h:outputLabel for="new_cognome" value="Cognome: *" />
					<p:inputText id="new_cognome" required="true" label="Cognome"
						value="#{utenteBean.user.cognome}" />
					<p:message for="new_cognome" display="icon" />


					<h:outputLabel for="new_dataNascita" value="Data di nascita: *" />
					<p:inputMask id="new_dataNascita" required="true"
						value="#{utenteBean.user.dataNascita}" mask="99/99/9999" />
					<p:message for="new_dataNascita" display="icon" />

					<h:outputLabel for="new_email" value="Email: *" />
					<p:inputText id="new_email" required="true" label="Email"
						value="#{utenteBean.user.email}">
						<!-- Controllo che venga inserita una email -->
						<f:validateRegex
							pattern="^[_A-Za-z0-9-\+]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})$" />
					</p:inputText>
					<p:message for="new_email" display="icon" />


					<h:outputLabel for="new_username" value="Username: *" />
					<p:inputText id="new_username" required="true" label="Username"
						value="#{utenteBean.user.username}" />
					<p:message for="new_username" display="icon" />

					<h:outputText value="Password: " />
					<p:password id="new_pass" value="#{utenteBean.user.password}"
						feedback="true" />
					<p:outputLabel />

					<h:outputText value="Ripeti Password: " />
					<p:password id="new_pass_repeat"
						value="#{utenteBean.user.rep_password}" feedback="false" />

					<f:facet name="footer">
						<p:commandButton value="Conferma" id="conferma"
							icon="ui-icon-check" update="register_form, growl"
							style="margin:0" actionListener="#{utenteBean.addUser}" />
						<!-- Messaggio di errore da utilizzare se ci sono "errori" nei dati -->
						<p:outputLabel id="error_message"
							value="#{utenteBean.errorMessage}" style="margin:30px;" />


					</f:facet>

				</p:panelGrid>


			</h:form>



		</p:layoutUnit>
		<!-- STOP - ZONA DX DELLA PAGINA -->

	</p:layout>


	<img class="content" src="resources/images/bottom.jpg"
		alt="immagine top"></img>



</h:body>
</html>